home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 05.zip
/
BS1 part 5
/
PDraw3.0.adf
/
pdraw_rex.lzh
/
_PD_TOOLS_BEZ.pdrx
next >
Wrap
Text File
|
1992-06-15
|
2KB
|
74 lines
/*
BEZIER TOOL
Click down at the position of the control point.
Drag tangent point to desired position and release.
Hit ESC to terminate an open curve.
Modifiers:
Double Clicking will bring up a requester which allows you to
create a multi-sided polygon.
Hold CONTROL and click & release mouse over an existing end
point to create closed curve or join to existing curve.
SHIFT - constrains Bezier to be a straight line.
ALT - constrains control points to be in a 45° direction
from the previous control point.
*/
msg = PDSetup.rexx(2,0)
units = getclip(pds_units)
if msg ~= 1 then exit_msg(msg)
numeric digits 8
pi2 = 6.28318
cr = '0a'x
sides = getclip(pduserpolysides)
radius = getclip(pduspolyradius)
if sides = '' then sides = 5
if radius = '' then radius = 1
if units > 2 then radius = pdm_ConvertUnits(1, units, radius)
sides = pdm_GetForm("Enter number of sides",8, "Sides:"sides || cr"Radius:"radius)
if sides = '' then exit_msg()
parse var sides nsides '0a'x radius
if ~(datatype(nsides, n) & datatype(radius, n)) then exit_msg("Invalid Entry")
if nsides < 3 then exit_msg("A polygon must have at least 3 sides")
if radius < 0 then exit_msg("Invalid entry")
if units > 2 then radius = pdm_ConvertUnits(units, 1, radius)
call setclip(pduserpolysides, nsides)
call setclip(pduspolyradius, radius)
ang = pi2 / nsides
posn = pdm_clickellipse("Click at position for polygon..",radius,radius)
if posn = '' then exit_msg()
call pdm_initplot(word(posn,1),word(posn,2),1,1,0)
call pdm_ShowStatus("Working..")
do steps = 0 to nsides - 1
theta = ang * steps
x = cos(theta) * radius
y = sin(theta) * radius
call pdm_plotline(x" "y)
end
call pdm_ClosePlot()
exit_msg()
exit_msg: procedure expose units
do
parse arg message
if message ~= '' then call pdm_Inform(1,message,)
call pdm_ClearStatus()
call pdm_SetUnits(units)
call pdm_AutoUpdate(1)
exit
end